/*
* Copyright (c) 18/5/15 foo.com. All Rights Reserved.
*/
package com.cgmnx.admin.biz;

import com.cgmnx.admin.dao.condition.NoteCondition;
import com.cgmnx.admin.dao.entity.NoteEntity;
import com.cgmnx.admin.service.NoteService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;

/**
 * @author: z Date: 18/5/15 Time: 下午10:26
 * @version: 1.0.0
 */
@Service
public class NoteBizImpl implements NoteBiz {

    @Resource
    private NoteService noteService;

    @Override
    public int count(NoteCondition condition){
        return noteService.count(condition);
    }

    @Override
    public List<NoteEntity> queryPage(NoteCondition condition) {
        return noteService.queryPage(condition);
    }

    @Override
    public NoteEntity query(Integer id) {
        return noteService.query(id);
    }

    @Override
    public void save(NoteEntity convert) {
        if(Objects.nonNull(convert.getId())){
            noteService.update(convert);
        }else{
            noteService.save(convert);
        }

    }

    @Override
    public void audit(Integer id, Integer newStatus, Integer oldStatus) {
        noteService.updateAudit(id, newStatus, oldStatus);
    }

}
